using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using 凌依.工具库;

public class 读取外部精灵
{
    public static Sprite 获取贴图(string path)
    {
        Texture2D texture2D = new Texture2D(0, 0);
        texture2D.LoadImage(IO操作.文件_读取字节(path));
        Sprite sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f));
        return sprite;
    }

    public static Sprite 获取贴图(byte[] bytes)
    {
        Texture2D texture2D = new Texture2D(0, 0);
        texture2D.LoadImage(bytes);
        Sprite sprite = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f));
        return sprite;
    }
}
